﻿namespace Voxel2Unity
{
    using System;
    using System.Runtime.InteropServices;

    [StructLayout(LayoutKind.Sequential)]
    public struct Voxel
    {
        private bool[] visible;
        private int colorIndex;
        public int ColorIndex
        {
            get
            {
                return this.colorIndex;
            }
            set
            {
                this.colorIndex = value;
            }
        }
        public bool IsEmpty
        {
            get
            {
                return (this.ColorIndex == 0);
            }
        }
        public bool IsVisible
        {
            get
            {
                return (((this.visible != null) && (this.visible.Length > 5)) && ((((this.visible[0] || this.visible[1]) || (this.visible[2] || this.visible[3])) || this.visible[4]) || this.visible[5]));
            }
            set
            {
                this.visible[0] = value;
                this.visible[1] = value;
                this.visible[2] = value;
                this.visible[3] = value;
                this.visible[4] = value;
                this.visible[5] = value;
            }
        }
        public bool AllVisible
        {
            get
            {
                return (((this.visible != null) && (this.visible.Length > 5)) && ((((this.visible[0] && this.visible[1]) && (this.visible[2] && this.visible[3])) && this.visible[4]) && this.visible[5]));
            }
            set
            {
                this.visible[0] = value;
                this.visible[1] = value;
                this.visible[2] = value;
                this.visible[3] = value;
                this.visible[4] = value;
                this.visible[5] = value;
            }
        }
        public bool VisibleLeft
        {
            get
            {
                return this.visible[4];
            }
            set
            {
                this.visible[4] = value;
            }
        }
        public bool VisibleRight
        {
            get
            {
                return this.visible[5];
            }
            set
            {
                this.visible[5] = value;
            }
        }
        public bool VisibleUp
        {
            get
            {
                return this.visible[0];
            }
            set
            {
                this.visible[0] = value;
            }
        }
        public bool VisibleDown
        {
            get
            {
                return this.visible[1];
            }
            set
            {
                this.visible[1] = value;
            }
        }
        public bool VisibleFront
        {
            get
            {
                return this.visible[2];
            }
            set
            {
                this.visible[2] = value;
            }
        }
        public bool VisibleBack
        {
            get
            {
                return this.visible[3];
            }
            set
            {
                this.visible[3] = value;
            }
        }
        public bool[] Visible
        {
            get
            {
                return this.visible;
            }
        }
        public void Init()
        {
            this.colorIndex = 0;
            this.visible = new bool[6];
        }
    }
}

